UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EF+2tH0HjRymadMq8ot4VLXocJCC/D3Q5v/ZBeSCrQ0=' 
WHERE 
  key_id = '4db2b0bb8177e0980f68afd275c1231528859360b2fff937ae138090753c43b2' 
  AND (
    token = 'EF+2tH0HjRymadMq8ot4VLXocJCC/D3Q5v/ZBeSCrQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022