UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4gqIZQDIw3KNWcLjvGqLAFYQ0Rh0q/AL8YHumUuQoEk='
WHERE
key_id = 'af2caab6d4a4f0ad8de5d0c8fd9b8a4a33c3062803db5c335711c932f2da433d'
AND (
token = '4gqIZQDIw3KNWcLjvGqLAFYQ0Rh0q/AL8YHumUuQoEk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)