UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LN0TmQRtieCyrCbdCzLyuqz5vFek3xXQaKnnrm315w8='
WHERE
key_id = '140bf92e398354b50fbffc44e25e284747cece58521e56add42dfc2d73c70fed'
AND (
token = 'LN0TmQRtieCyrCbdCzLyuqz5vFek3xXQaKnnrm315w8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)