UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AyRoZK40sUqpk18GZrZ9bP8xM89WZUX/ZG6LcqldRXU=' 
WHERE 
  key_id = 'ddc67527d50fc02e166f9312c525f5af0749f8b5805107ba46d6a8eedcff0fe5' 
  AND (
    token = 'AyRoZK40sUqpk18GZrZ9bP8xM89WZUX/ZG6LcqldRXU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021