UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tbiX4ng1B06pTPopPldOc0iY+qB5e7F0E97wKMOqBKQ=' 
WHERE 
  key_id = '3585c608525183ae1909da63c7ddaf94eb0c65ba377a9e346868590d48500495' 
  AND (
    token = 'tbiX4ng1B06pTPopPldOc0iY+qB5e7F0E97wKMOqBKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051