UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rvhDzn+pJn1L8e7PDViyreU9uqmgQc4Y+mI6yofmIYA=' 
WHERE 
  key_id = '4e9e28b416b18f452217637beb637249f6fc267533f9af4b1fbaceee970d67e9' 
  AND (
    token = 'rvhDzn+pJn1L8e7PDViyreU9uqmgQc4Y+mI6yofmIYA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019