UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sAIGdok5HMXAN9F8v4yMVr8sm2HX3iGtoVGIoJSNlZo=' 
WHERE 
  key_id = '3fab6e78484217af6505672f50f7927222fef0f0751e550559a1ab98d0864f1f' 
  AND (
    token = 'sAIGdok5HMXAN9F8v4yMVr8sm2HX3iGtoVGIoJSNlZo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032