UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oTPadb1U/bs4agddoS2mUsx6NUrqQpe8IpbiWPS3PK0=' 
WHERE 
  key_id = '9bdd93085db8e88ddd8ab0227aff25cffa336bd86e033bfa625455619eabfab1' 
  AND (
    token = 'oTPadb1U/bs4agddoS2mUsx6NUrqQpe8IpbiWPS3PK0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030