UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O4hHjb9LgJTPDcB5LTrww4mPmqTqaxldke+7yUMHoOo='
WHERE
key_id = '3d693c7d711529e878a583a3908f398544d1bc3265cfa4fb67f40a682f820090'
AND (
token = 'O4hHjb9LgJTPDcB5LTrww4mPmqTqaxldke+7yUMHoOo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)