UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UBp+wvCERRvoaEhjFtFVrcii9q/7adjiigpEgfxrxtM=' 
WHERE 
  key_id = 'c0d40bbffd7ad0fd0e6b659b314260b41864011a8c0f7239c5fae69ddc9d2e6b' 
  AND (
    token = 'UBp+wvCERRvoaEhjFtFVrcii9q/7adjiigpEgfxrxtM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026