UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xVaGMWT2/jZaJBq4duiBszwJzJmw3xg2sCuFsbsj9IA='
WHERE
key_id = 'a1aa9be707bb45ce75003cafed4544c89d4c8c053c773ccd472a0388fe16827f'
AND (
token = 'xVaGMWT2/jZaJBq4duiBszwJzJmw3xg2sCuFsbsj9IA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)