UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tS8lCFAkczxu04zjh/tKJLHXgu7n9Za7hmF4TfSPG3o='
WHERE
key_id = 'f30bc5830e7dc035cd131803c8185cc4be589e67c4b1e562716b88882eabdcc4'
AND (
token = 'tS8lCFAkczxu04zjh/tKJLHXgu7n9Za7hmF4TfSPG3o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)