UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GpSzfXPz4Kg7JJWYPFeXTTt8/stA5rTu4SDs+wvMrk4=' 
WHERE 
  key_id = '77576b97c09672d9decb0cb90ad489d660644a902bc569e1f87019bae8c8ab00' 
  AND (
    token = 'GpSzfXPz4Kg7JJWYPFeXTTt8/stA5rTu4SDs+wvMrk4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049