UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DS/8td383hdb0xG8xDlkEFWZt0OfodmxaKcHULvgCH4='
WHERE
key_id = 'd242aadcd61059c4978186d2a40fbf27472f787ae4841c2a2a7f39eb775afc62'
AND (
token = 'DS/8td383hdb0xG8xDlkEFWZt0OfodmxaKcHULvgCH4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)