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