UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7NV9B+GM2nrxG7+pzxm0l+cxvOrTTGm56jaVWd0y5gk='
WHERE
key_id = 'c338d1c794e95438236e8a28ad4a17ca0975ded6b186422dfec6a2cb98ef7e57'
AND (
token = '7NV9B+GM2nrxG7+pzxm0l+cxvOrTTGm56jaVWd0y5gk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)