UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nLPilKVqbx3al2+NKFWXrXoz1ludobPJTx3bntQbgy8=' 
WHERE 
  key_id = '65555b2e8450eefbad8851f3de79d03a682d806cdb94a22b172d0f4f0d71e05c' 
  AND (
    token = 'nLPilKVqbx3al2+NKFWXrXoz1ludobPJTx3bntQbgy8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037