UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LA+hmUixwoHvkH6CdQO8ARO5nTc8BYarey3hs2l40wc=' 
WHERE 
  key_id = '1295b51e119a1271da438eb8d7e27a12615b2a459b52259d2bfa8b760ec35dd6' 
  AND (
    token = 'LA+hmUixwoHvkH6CdQO8ARO5nTc8BYarey3hs2l40wc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050