UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd9YqeOxeXsiqjjRbhwyb+F8fFcV7ptB4z/przAHntnI=' 
WHERE 
  key_id = 'd647240b4b4ce2f2769478fcc260b84ba3a48b7235052d3181ff078b551b450a' 
  AND (
    token = 'd9YqeOxeXsiqjjRbhwyb+F8fFcV7ptB4z/przAHntnI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038