UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cmTo5GlIzse3NnI56sqieSslN4Zs8Etidxb3/ttau0g='
WHERE
key_id = '7d5f390c34410a1f6b6c6c15208bf6dcc20984527902469f59b51eec31f5f3ee'
AND (
token = 'cmTo5GlIzse3NnI56sqieSslN4Zs8Etidxb3/ttau0g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)