UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's46dM8EPkgw1mupXL6Av/89eCJraefeiyboCwSyc8XY='
WHERE
key_id = 'fad581ed4f727c931e88580c4bbdd6623771ffc81e02337cd356951a25fb3f25'
AND (
token = 's46dM8EPkgw1mupXL6Av/89eCJraefeiyboCwSyc8XY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)