UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qpYI8V4BmvyJZD6C4kMMaC975YSXAGMz170Ui+wZqqg='
WHERE
key_id = '2936e4112c89af535a1a020af72fd59d235669a4cd7d85c0a6e4165adf2a40af'
AND (
token = 'qpYI8V4BmvyJZD6C4kMMaC975YSXAGMz170Ui+wZqqg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)