UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lubBAeKLM1FdjVDpn4wg6q5/tLmt9zZgr+4g4IcSJ40='
WHERE
key_id = '9929f84b2f3008a4eb06c41d5f21e01c3d6054a457feb2205802f7148923e7a0'
AND (
token = 'lubBAeKLM1FdjVDpn4wg6q5/tLmt9zZgr+4g4IcSJ40='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)