UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MiisgAPCtucoGiLkRH9hbxRJwlJ+AMxd1DIckOL95Hc=' 
WHERE 
  key_id = '61dd8eaee54b5a2d2a71a4e9fbefef0f9a9816e873110a59a9f97b667c553001' 
  AND (
    token = 'MiisgAPCtucoGiLkRH9hbxRJwlJ+AMxd1DIckOL95Hc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033