UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '56AxjEu8r+4AzpQTKvj4xPtZb12rwuc65UGgLeOZvkU='
WHERE
key_id = '3409602b2159115aa3856541878b55d183291cb1b6dda1b81ea1e552f254ea7d'
AND (
token = '56AxjEu8r+4AzpQTKvj4xPtZb12rwuc65UGgLeOZvkU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)