UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm7ZRlG4v+IucIZwr0137bA96kH8YQgVlS8wJhVpIRn0=' 
WHERE 
  key_id = '378b4434b4ba7b11167ef7f85c094d6729574e59cecbc003a5a859c707aea133' 
  AND (
    token = 'm7ZRlG4v+IucIZwr0137bA96kH8YQgVlS8wJhVpIRn0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058