UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fSfJBDNeWTINMJ+Mjj9/xJSLm8W2uKhZedW6dhNtamU=' 
WHERE 
  key_id = '09277886f675379abc6a3e767e3239841fb2234779b7b079119e54deb4bd36b1' 
  AND (
    token = 'fSfJBDNeWTINMJ+Mjj9/xJSLm8W2uKhZedW6dhNtamU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035