UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P5aH2Sel+beaixrEz10af4EkTYvRmsV5AJuR81+dcjQ=' 
WHERE 
  key_id = '96a4860c6420e7ea5eb6448c2c8a600d68c3dbdf796edd4e08c0bab2c5f83631' 
  AND (
    token = 'P5aH2Sel+beaixrEz10af4EkTYvRmsV5AJuR81+dcjQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044