UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gcZdKQ86tCGos79X2rL7krNnZ6BL/MZQYhgXjkCGEss='
WHERE
key_id = '96d132b6c1879ef6af3bacdc42d53a3904de3054e49b7c500ab5c97be192c1b5'
AND (
token = 'gcZdKQ86tCGos79X2rL7krNnZ6BL/MZQYhgXjkCGEss='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)