UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lkx3Z/X5GcXUdw6fFE95c8uyuaUdp7VHF5lZc2E8xFo=' 
WHERE 
  key_id = '0532d49dd2403f2139b039f52b908c5e98c617f6c6cecc2afcf2d78b940d0140' 
  AND (
    token = 'lkx3Z/X5GcXUdw6fFE95c8uyuaUdp7VHF5lZc2E8xFo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044