UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8MRgDY/eZQyznGj4tukVKIBaWkP0c74/19w0RkL6FbY=' 
WHERE 
  key_id = '8a6faf224ebd58137b105856c275f91f461fd82bf7661feea4dc62b9df917f76' 
  AND (
    token = '8MRgDY/eZQyznGj4tukVKIBaWkP0c74/19w0RkL6FbY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050