UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0rlIQnDbJToHi1EyJv3mlpTHz3wc2aETIJolZehG7ws=' 
WHERE 
  key_id = '6878080b529b3edb8edf5d46cdb237958545ea94c80d4461910ae237cb38ca56' 
  AND (
    token = '0rlIQnDbJToHi1EyJv3mlpTHz3wc2aETIJolZehG7ws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050