UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LDbHU21MAOWA9nLyj+R1p3iKMbO9nTLNwVrbNGLdsRo='
WHERE
key_id = '3d74aa5d142db31166ca8f7bd197900b96dddf39e8aa489e8878dfc88105fe5b'
AND (
token = 'LDbHU21MAOWA9nLyj+R1p3iKMbO9nTLNwVrbNGLdsRo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)