UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aENxk3m81WFQw9EFnpv0R3HtsjGi+I38vIiJO7CTTTU=' 
WHERE 
  key_id = 'eda683a677ad7466ee3a796321fa7aca392b50fefad85b21abe5d6551aeaabed' 
  AND (
    token = 'aENxk3m81WFQw9EFnpv0R3HtsjGi+I38vIiJO7CTTTU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026