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