UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lFJvQz2pnV0aukjW7HtLOY9bSISJrg8FpLBfMchL+ec=' 
WHERE 
  key_id = 'a454f41c9655cd1e252dcdae5cd851df005bab1e2f778762c25290223b60ff66' 
  AND (
    token = 'lFJvQz2pnV0aukjW7HtLOY9bSISJrg8FpLBfMchL+ec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037