UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nn2qiUjlS4JUqAZfdw1bm37nufI8yj2R+cdJECEzT4w='
WHERE
key_id = 'b19623cd260448e32e97b0ed500ffe19757eb493c04210c6a1a0806bb61adc54'
AND (
token = 'nn2qiUjlS4JUqAZfdw1bm37nufI8yj2R+cdJECEzT4w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)