UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0FoHbHayj6n+txTLTvo8N7y883ZbNwmYm0iypS68hMU=' 
WHERE 
  key_id = '51a236fb589a6d51729f7751b5154dd95b998398469caa3debb51626c6c5e764' 
  AND (
    token = '0FoHbHayj6n+txTLTvo8N7y883ZbNwmYm0iypS68hMU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024