UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l/PNUek+u1Yi15gwo9VS0hjc4WEy53VpwQmh3zZs/K0=' 
WHERE 
  key_id = 'c164022ba2538163858540e10333aae33185aee0bee42eafb4c831bba55a3a0d' 
  AND (
    token = 'l/PNUek+u1Yi15gwo9VS0hjc4WEy53VpwQmh3zZs/K0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035