UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'diV5LRWU0M0xYlpR9Tak0ZDrxpL2bJQ2Dizkyn3Ms1Q=' 
WHERE 
  key_id = '8984650da6cd3f475535d2208394e1729bc2ae79b75f1f0d9b97ecb6c39362eb' 
  AND (
    token = 'diV5LRWU0M0xYlpR9Tak0ZDrxpL2bJQ2Dizkyn3Ms1Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039