UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'INyCMM3EaD4krWQMFyQvi90I+6+jcTUugTQLtcgvsmI=' 
WHERE 
  key_id = '6efa82639ce14100ae2bd1c83f44cf267c02c563f9558ed88885caa0e53251a0' 
  AND (
    token = 'INyCMM3EaD4krWQMFyQvi90I+6+jcTUugTQLtcgvsmI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032