UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6A+EX6tjwAVM8PM8m80127SrLzGdl8VkA0VdM6z+cNQ='
WHERE
key_id = '3880ac0f5b3902acb396e4a382a9b6dcb4b49714c3b2312f644d7f467df990d4'
AND (
token = '6A+EX6tjwAVM8PM8m80127SrLzGdl8VkA0VdM6z+cNQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)