UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iUGUFoW9ehBiIC6bkBckqetp9j6roPm3d7yNX34cw30='
WHERE
key_id = '1ac67927632ef1b1889943c0f1c046a3b1e2bd770b35302b1c4964df72925919'
AND (
token = 'iUGUFoW9ehBiIC6bkBckqetp9j6roPm3d7yNX34cw30='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)