UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AIZH39bBVNSw4ofy2DBRPoBFI2z8s/gvAG4a0A5DuNA=' 
WHERE 
  key_id = '10ad695b7a48c318228da146ee98a2d7b303f9531e7429a6eebd05843ead1d32' 
  AND (
    token = 'AIZH39bBVNSw4ofy2DBRPoBFI2z8s/gvAG4a0A5DuNA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046