UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PJ4ZzffvCUotyemusdB+H4XzRcHNZTNHnKWG9dWFWUY='
WHERE
key_id = 'e6a853242bc17d3ac8a6d30e611b7a6d6cb05b391a8c29c426355b578b1cf52a'
AND (
token = 'PJ4ZzffvCUotyemusdB+H4XzRcHNZTNHnKWG9dWFWUY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)