UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jkoiKyAgqo92LmUZTU6EU8OGctgTofnkjz1SaH+GgMU=' 
WHERE 
  key_id = '9e3393fe84ea59c2bcb813edc7c000118cc82b33ea6e81f8d08f94e51be4040f' 
  AND (
    token = 'jkoiKyAgqo92LmUZTU6EU8OGctgTofnkjz1SaH+GgMU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027