UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bTExm7LlxASa4fj4buETVCGdGk7Owa0xjWRL/6klj90='
WHERE
key_id = 'd227139a25276e8dc3cf979d2013b8a8eec71199b250d87c3929ca654759e3e7'
AND (
token = 'bTExm7LlxASa4fj4buETVCGdGk7Owa0xjWRL/6klj90='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)