UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ed7BS3aVGIIG86Pp8WL2f/FaiK2poIx685MA5dHOBhc=' 
WHERE 
  key_id = '9556e0fb2fec872311753a17d8991992a8b1e89370a1bcb2ae5ea2d87de12872' 
  AND (
    token = 'Ed7BS3aVGIIG86Pp8WL2f/FaiK2poIx685MA5dHOBhc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020