UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CD26U8nW4nWwDec47lvbL4J89Lf1AroccuMGvgUElKk='
WHERE
key_id = 'bf8032016f1cf003e3e6852aa7a285de536d5631deeecfa528500b75eef17d4e'
AND (
token = 'CD26U8nW4nWwDec47lvbL4J89Lf1AroccuMGvgUElKk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)