UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P39APMfDSDFWQokTJaN+mZohplFAITFq9BlsVASQjWs='
WHERE
key_id = '2804873ea7ca8af932f1d3e13a900a45005053d2521572459ce278b75c78c76a'
AND (
token = 'P39APMfDSDFWQokTJaN+mZohplFAITFq9BlsVASQjWs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)