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