UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XXyWFa2xOvRm5Yl5ejrooTbK83pawclOWaHztK6XhJw=' 
WHERE 
  key_id = '801a63a905b01e3cfb82c50035e10aab50884a53908bb125f01697fcbda6fbf5' 
  AND (
    token = 'XXyWFa2xOvRm5Yl5ejrooTbK83pawclOWaHztK6XhJw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032