UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5I7v/zk9QmlCQjVis7EmYbXiHZVKMwz6gQe7d5U+gyA='
WHERE
key_id = '8b66cbd2296b91077952f32d9bfb1e7ef513678fb73b3d265683b0c74a985d59'
AND (
token = '5I7v/zk9QmlCQjVis7EmYbXiHZVKMwz6gQe7d5U+gyA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)