UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+ODqzMaGGpCtSwdxIA9f2atl2jV839JVJXOgPfeu5wM='
WHERE
key_id = '21c72c99715ca6b813281cc2fd7a18e2a8f531f31c3c15138f2af4fb36d7207b'
AND (
token = '+ODqzMaGGpCtSwdxIA9f2atl2jV839JVJXOgPfeu5wM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)