UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9mmva5RMiRhUk5bYB6j6DX3QfnbxfIzUWWKcY+8Smkc='
WHERE
key_id = '4e9aa64b7d10dd006e1d3b0982d82b563ba68bf205f4260c7237d83059a3990b'
AND (
token = '9mmva5RMiRhUk5bYB6j6DX3QfnbxfIzUWWKcY+8Smkc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)