UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9gEXmUY3GIgJdhefzVrlPpfG9wMHwyr1/lFog9npmgA='
WHERE
key_id = '40ea7f6d615c07f42ea9fc556f27b7ebdcb32415a1df150ad419fcf6339c965a'
AND (
token = '9gEXmUY3GIgJdhefzVrlPpfG9wMHwyr1/lFog9npmgA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)