UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C+sw/ldmSdRckt4MemXKqFuJzrwyf562tUcqajOoxIk=' 
WHERE 
  key_id = '6adbaa3a768253945091b0311da021e6dd4f040e73a7fe22081af1c907928f77' 
  AND (
    token = 'C+sw/ldmSdRckt4MemXKqFuJzrwyf562tUcqajOoxIk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026