UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lBxX5Lz44iQi2bO+9xCQ3eVZ+oRXyT7qkO114hX7mrI=' 
WHERE 
  key_id = '8872c8afc3e53247d61330429484060c37db0650671f3dda3fbbfffea5046416' 
  AND (
    token = 'lBxX5Lz44iQi2bO+9xCQ3eVZ+oRXyT7qkO114hX7mrI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060