UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GAM+mheSTVDmSq9zDoUdSHl4AltL6Pk2jqKaOjoxxY4='
WHERE
key_id = '16bb151a6a6c7ff41aeff09379c7517f4743c63e1566a5918245c4b2ff4583b5'
AND (
token = 'GAM+mheSTVDmSq9zDoUdSHl4AltL6Pk2jqKaOjoxxY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)