UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ve912iHM6/sIwUDq18bzSwO+nKwHTKfmUI3q0Egu3Yc=' 
WHERE 
  key_id = '322857a185d5008901bd74f3f2aa68ff6cca518fca68c3d275866a123f94bc5e' 
  AND (
    token = 'Ve912iHM6/sIwUDq18bzSwO+nKwHTKfmUI3q0Egu3Yc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00071