UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OIazjUlSN7fSbSiEw6gc4Dkq58z/GbjZoqzIZbRgSxE=' 
WHERE 
  key_id = '3ed7abe8b7c1b31454f8f48487d5ae88d1185fbf8367f2960402919b344379b0' 
  AND (
    token = 'OIazjUlSN7fSbSiEw6gc4Dkq58z/GbjZoqzIZbRgSxE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033