UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BP7okhArTxDOy4POqOM2kolQGNB+diTAvY+Oyx26/xk='
WHERE
key_id = 'a180280102c3da5e08120ec578ef8e0f643c527dcabfb24212d9f320e10d7923'
AND (
token = 'BP7okhArTxDOy4POqOM2kolQGNB+diTAvY+Oyx26/xk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)