UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jETSJyawsy2ufh8lve8GZegIFRHyBaOSd8lyIjBgQgs='
WHERE
key_id = '540dda948df1c0264bd783865850b889d8994f1e78a8f91b9ff48d1621fbeadd'
AND (
token = 'jETSJyawsy2ufh8lve8GZegIFRHyBaOSd8lyIjBgQgs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)