UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zaJQHWiRci+RmMzGMiyYNEshNCqwMhXCTnuS++d15mE=' 
WHERE 
  key_id = '5341012bafd3bbde86bbc4f90a5b64dce238d7900e78d0c163350a78467335eb' 
  AND (
    token = 'zaJQHWiRci+RmMzGMiyYNEshNCqwMhXCTnuS++d15mE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053