UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rlgB5aeUr62zrYMrPoUJpsc9Rob2VO81O2+ImX46/Qo='
WHERE
key_id = 'cec947e30f162bb7bef65886c3c84dc99ab93677241ea6932ba9e66ec06aca50'
AND (
token = 'rlgB5aeUr62zrYMrPoUJpsc9Rob2VO81O2+ImX46/Qo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)