UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X501PmOz8tQebz10COYLchcDpcP4A7PLPqpf4xikkoM=' 
WHERE 
  key_id = '0ebc1c2940aaac689bc958dde6b5cbb8f5a31f1d3982ef6183496037e06d2ed7' 
  AND (
    token = 'X501PmOz8tQebz10COYLchcDpcP4A7PLPqpf4xikkoM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035