UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lMJLVaSigaCT3mKwt9TrZMyieeEQw22zNsLBpToCA0c=' 
WHERE 
  key_id = 'e265187fd8ecde69451b6f66f640e88aa52849956478c7bdb9a906b53808d1fc' 
  AND (
    token = 'lMJLVaSigaCT3mKwt9TrZMyieeEQw22zNsLBpToCA0c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038