UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w7SCK/Qm8RB7FE9KtDK+4W9qheOEw/zO0n5Mqq34bzA='
WHERE
key_id = '02ee5b54d644988aa5660b8c0801731f0951db4626a579c93f0512a76a5028a9'
AND (
token = 'w7SCK/Qm8RB7FE9KtDK+4W9qheOEw/zO0n5Mqq34bzA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)