UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nbYe2F6JkzoVFmI5ksznlhNd8F1jZFYQbEB3j9+oXyY=' 
WHERE 
  key_id = 'f4e430fb4d8292de1297d7b3188a8eb059483e0d39897bc39186c94327645691' 
  AND (
    token = 'nbYe2F6JkzoVFmI5ksznlhNd8F1jZFYQbEB3j9+oXyY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053