UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iW/TY4CNnUOrQ8XIhpyfWQjy+PMfgRu/od0fdTA0LdU='
WHERE
key_id = '39a05a13a942c553b27550e6275a9fe84773dcdd94971ce583111d0a44cb467d'
AND (
token = 'iW/TY4CNnUOrQ8XIhpyfWQjy+PMfgRu/od0fdTA0LdU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)