UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ugetr4LdvvRW5nio6VKHYx1FVFMihzDOruhcKsgNiPk=' 
WHERE 
  key_id = 'c20462552bd840050b333cc625a6605f88ce622880bca32b433ecf95fd18699f' 
  AND (
    token = 'ugetr4LdvvRW5nio6VKHYx1FVFMihzDOruhcKsgNiPk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029