UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'maLUoIieGc1cDXE4BzRmvAdKf+3Ps3EIkuwH4KSvvE8='
WHERE
key_id = 'f9e1ff86102ee50e17213cdeb9a535d3a4a8191ce95d895daf57416c055917b0'
AND (
token = 'maLUoIieGc1cDXE4BzRmvAdKf+3Ps3EIkuwH4KSvvE8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)