UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eaoQTG6Cmab3t4gyuoGivndySlni93PpTdSnHIl/Eow=' 
WHERE 
  key_id = '1d70fd1405a508e63d4b6bf3e09ad7c58bd2c2e9c50e88fe7b63e32333e7bea2' 
  AND (
    token = 'eaoQTG6Cmab3t4gyuoGivndySlni93PpTdSnHIl/Eow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035