UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BOwdYdoEIV62lyBOWTfv51uBa8lucz+F6837nZZDDj8='
WHERE
key_id = '8fa913f28f5b4c1bc3229c0e2dbb99fef9a51a3dd93aaf1eb514d6fe7184ebb3'
AND (
token = 'BOwdYdoEIV62lyBOWTfv51uBa8lucz+F6837nZZDDj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)