UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GioEGa40XlAlfCzj26JA+L1ckE2PS8B5u+wvACVVe6U=' 
WHERE 
  key_id = '646c7c36858d0fd7d47d7e985c7791b24b85d3f499a2ec5164ea637b2331cae9' 
  AND (
    token = 'GioEGa40XlAlfCzj26JA+L1ckE2PS8B5u+wvACVVe6U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031